<template>
	<view>
		<uni-section title="图片" sub-title="" type="square">
			<image :src="baseUrl+data.icon" mode="" style="width: 100%;"></image>
		</uni-section>
		<uni-section title="名称" sub-title="" type="square">
			{{data.name}}
		</uni-section>
		<uni-section title="描述" sub-title="" type="square">
			{{data.description}}
		</uni-section>
		<uni-section title="价格" sub-title="" type="square">
			{{'￥'+data.price+'元'}}
		</uni-section>
		<button type="default">查看评论</button>
		<button type="default">添加评论</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				baseUrl: 'http://localhost:8090/foodapp',
				"data": {
					"id": 1,
					"name": "烤鸭",
					"label": "烤鸭烤鸭烤鸭",
					"icon": "/images/1.png",
					"price": 88,
					"description": "烤鸭烤鸭烤鸭烤鸭烤鸭",
					"type": "肉类"
				}
			}
		},
		onLoad(opt) {
			uni.request({
				url: 'http://localhost:8090/foodapp/food/findone',
				method: 'POST',
				data: {"id": opt.id},
				success: res => {
					if (res.data.success) {
						this.data = res.data.data
						uni.showToast({
							title: '成功'
						});
					} else{
						uni.showToast({
							title: '失败',
							icon: 'none'
						});
					}
				},
				fail: () => {
					uni.showToast({
						title: '网络失败',
						icon: 'none'
					});
				},
				complete: () => {}
			});
		},
		methods: {

		}
	}
</script>

<style>

</style>
